﻿using BruTile.Predefined;

namespace WinFormSamples.Samples
{
    public class HeatLayerSample
    {
        public static SharpMap.Map InitializeMap(float angle)
        {
            var fdt = GetRealFeatureDataTable();
            FillRealDataTable(fdt);

            var p = new SharpMap.Data.Providers.GeometryFeatureProvider(fdt);


            var m = new SharpMap.Map();
            var tl = new SharpMap.Layers.TileAsyncLayer(KnownTileSources.Create(KnownTileSource.OpenStreetMap),
                "TileLayer with HeatLayer", System.Drawing.Color.Transparent, false,
                new BruTile.Cache.FileCache(@"d:\temp\OSM", "png"), System.Drawing.Imaging.ImageFormat.Png);
            m.BackgroundLayer.Add(tl);

            //var l = new SharpMap.Layers.HeatLayer(p, r => 0.02f) { LayerName = "HEAT" };
            var l = new SharpMap.Layers.HeatLayer(p, "Data", 0.00025f) { LayerName = "HEAT" };
            m.Layers.Add(l);

            var ctfac = new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory();
            l.CoordinateTransformation =
                ctfac.CreateFromCoordinateSystems(ProjNet.CoordinateSystems.GeographicCoordinateSystem.WGS84,
                                                  ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator);

            l.ZoomMin = 0;// 0.01 * m.GetExtents().Width;
            l.ZoomMax = /*0.9 * */m.GetExtents().Width;
            l.OpacityMax = 0.5f;
            l.OpacityMin = 0.9f;

            l.HeatColorBlend = SharpMap.Layers.HeatLayer.Classic;

            var env = l.Envelope;
            GeoAPI.Geometries.GeoAPIEx.Grow(env, env.Width * 0.05, env.Height * 0.05);
            //m.EnforceMaximumExtents = true;
            //m.MaximumExtents = env;
            m.ZoomToBox(env);

            return m;
        }

        private static SharpMap.Data.FeatureDataTable GetRealFeatureDataTable()
        {
            var res = new SharpMap.Data.FeatureDataTable();
            res.Columns.Add("Oid", typeof(uint));
            res.Columns.Add("Data", typeof(int));

            return res;
        }

        private static void FillRealDataTable(SharpMap.Data.FeatureDataTable table)
        {
            table.BeginLoadData();
            var factory = GeoAPI.GeometryServiceProvider.Instance.CreateGeometryFactory(4326);

            uint id = 0;
            foreach (var datas in PointData())
            {
                var row = (SharpMap.Data.FeatureDataRow)table.LoadDataRow(new object[] { id++, datas[0] }, System.Data.LoadOption.OverwriteChanges);
                row.Geometry = factory.CreatePoint(new GeoAPI.Geometries.Coordinate(datas[2], datas[1]));
            }
            table.EndLoadData();
        }

        private static System.Collections.Generic.IEnumerable<double[]> PointData()
        {
            return new System.Collections.Generic.List<double[]>(new[]
                {
                    new [] {339, 21.400000, -157.797429},
                    new [] {796, 25.850000, -80.185260},
                    new [] {751, 26.020000, -80.240183},
                    new [] {315, 26.140000, -81.795000},
                    new [] {788, 26.450000, -80.101878},
                    new [] {429, 26.570000, -80.059085},
                    new [] {251, 26.630000, -81.872387},
                    new [] {401, 26.680000, -81.898955},
                    new [] {18, 26.740000, -81.406740},
                    new [] {553, 27.250000, -80.831178},
                    new [] {768, 27.270000, -82.530540},
                    new [] {579, 27.320000, -81.367043},
                    new [] {313, 27.600000, -81.501486},
                    new [] {789, 27.630000, -80.432813},
                    new [] {230, 27.640000, -80.393423},
                    new [] {767, 27.780000, -82.694739},
                    new [] {766, 27.890000, -82.324265},
                    new [] {293, 27.890000, -82.790722},
                    new [] {736, 27.950000, -81.923074},
                    new [] {63, 28.060000, -81.786049},
                    new [] {757, 28.060000, -82.459355},
                    new [] {467, 28.070000, -81.812234},
                    new [] {11, 28.110000, -81.624056},
                    new [] {584, 28.130000, -80.627390},
                    new [] {576, 28.220000, -81.293059},
                    new [] {361, 28.230000, -80.680889},
                    new [] {583, 28.230000, -80.698238},
                    new [] {765, 28.300000, -81.338012},
                    new [] {573, 28.420000, -80.752035},
                    new [] {705, 28.470000, -81.362895},
                    new [] {320, 28.540000, -81.377507},
                    new [] {591, 28.550000, -81.475879},
                    new [] {781, 28.560000, -80.815052},
                    new [] {578, 28.570000, -81.584661},
                    new [] {760, 28.620000, -81.250675},
                    new [] {100, 28.670000, -82.106923},
                    new [] {581, 28.700000, -81.347538},
                    new [] {724, 28.780000, -81.347362},
                    new [] {136, 28.800000, -81.640566},
                    new [] {574, 28.870000, -82.599168},
                    new [] {735, 29.060000, -82.054651},
                    new [] {764, 29.110000, -81.020134},
                    new [] {729, 29.190000, -82.083761},
                    new [] {725, 29.190000, -82.132731},
                    new [] {838, 29.270000, -81.099948},
                    new [] {285, 29.450000, -98.497421},
                    new [] {389, 29.560000, -81.237477},
                    new [] {807, 29.660000, -95.130076},
                    new [] {135, 29.680000, -82.367940},
                    new [] {726, 29.700000, -98.126991},
                    new [] {103, 29.710000, -82.648631},
                    new [] {776, 29.710000, -98.127966},
                    new [] {819, 29.810000, -98.740893},
                    new [] {351, 29.860000, -90.047145},
                    new [] {805, 29.880000, -81.298367},
                    new [] {804, 29.880000, -98.285363},
                    new [] {738, 29.940000, -90.104909},
                    new [] {818, 30.040000, -99.140817},
                    new [] {176, 30.110000, -95.607263},
                    new [] {235, 30.130000, -81.786692},
                    new [] {300, 30.130000, -84.345674},
                    new [] {68, 30.170000, -81.764096},
                    new [] {468, 30.180000, -93.219208},
                    new [] {262, 30.190000, -81.600562},
                    new [] {374, 30.240000, -81.552303},
                    new [] {144, 30.280000, -82.121438},
                    new [] {295, 30.290000, -81.727368},
                    new [] {250, 30.290000, -81.789245},
                    new [] {307, 30.310000, -81.605516},
                    new [] {240, 30.330000, -81.417257},
                    new [] {733, 30.370000, -81.596726},
                    new [] {421, 30.430000, -84.215300},
                    new [] {299, 30.430000, -91.026142},
                    new [] {420, 30.440000, -91.090594},
                    new [] {479, 30.450000, -84.279467},
                    new [] {239, 30.480000, -84.318377},
                    new [] {478, 30.540000, -84.216239},
                    new [] {418, 30.550000, -90.227644},
                    new [] {188, 30.600000, -87.903611},
                    new [] {763, 30.650000, -88.207642},
                    new [] {749, 30.670000, -81.462778},
                    new [] {95, 30.720000, -81.549510},
                    new [] {823, 30.840000, -83.978889},
                    new [] {163, 31.170000, -83.788916},
                    new [] {407, 31.440000, -100.479628},
                    new [] {59, 31.510000, -82.847066},
                    new [] {391, 31.690000, -98.975309},
                    new [] {26, 31.700000, -98.124370},
                    new [] {173, 31.720000, -98.985536},
                    new [] {284, 31.760000, -106.488585},
                    new [] {200, 31.800000, -97.515282},
                    new [] {728, 31.840000, -106.530971},
                    new [] {669, 31.850000, -96.796327},
                    new [] {146, 31.900000, -98.603887},
                    new [] {352, 32.000000, -102.089999},
                    new [] {472, 32.010000, -97.123356},
                    new [] {242, 32.030000, -102.091483},
                    new [] {309, 32.070000, -81.096677},
                    new [] {279, 32.080000, -81.089138},
                    new [] {507, 32.090000, -96.468091},
                    new [] {212, 32.090000, -98.345469},
                    new [] {785, 32.150000, -80.779153},
                    new [] {504, 32.180000, -95.857678},
                    new [] {631, 32.220000, -80.752778},
                    new [] {670, 32.220000, -98.222407},
                    new [] {19, 32.230000, -80.863109},
                    new [] {821, 32.260000, -107.768750},
                    new [] {50, 32.270000, -86.611389},
                    new [] {17, 32.340000, -90.077056},
                    new [] {808, 32.340000, -96.642953},
                    new [] {542, 32.350000, -97.385083},
                    new [] {849, 32.380000, -86.232492},
                    new [] {368, 32.380000, -86.304871},
                    new [] {806, 32.390000, -96.163333},
                    new [] {175, 32.410000, -98.818124},
                    new [] {36, 32.420000, -97.238368},
                    new [] {150, 32.430000, -80.674066},
                    new [] {601, 32.430000, -96.873605},
                    new [] {668, 32.440000, -97.683466},
                    new [] {711, 32.460000, -93.721558},
                    new [] {201, 32.490000, -80.949435},
                    new [] {739, 32.510000, -92.124297},
                    new [] {731, 32.540000, -92.067849},
                    new [] {833, 32.540000, -95.883143},
                    new [] {431, 32.550000, -94.371334},
                    new [] {197, 32.570000, -105.939028},
                    new [] {48, 32.570000, -80.283015},
                    new [] {802, 32.590000, -83.641578},
                    new [] {147, 32.590000, -96.308611},
                    new [] {656, 32.590000, -97.127470},
                    new [] {174, 32.600000, -96.767751},
                    new [] {633, 32.610000, -80.152594},
                    new [] {343, 32.610000, -96.951808},
                    new [] {831, 32.620000, -96.874188},
                    new [] {399, 32.660000, -117.041286},
                    new [] {256, 32.660000, -96.762505},
                    new [] {650, 32.660000, -97.004569},
                    new [] {180, 32.670000, -95.487313},
                    new [] {539, 32.670000, -97.078613},
                    new [] {645, 32.670000, -97.368950},
                    new [] {844, 32.680000, -114.624630},
                    new [] {546, 32.680000, -97.186941},
                    new [] {550, 32.690000, -97.271407},
                    new [] {549, 32.690000, -97.336823},
                    new [] {231, 32.700000, -114.637567},
                    new [] {644, 32.700000, -97.282870},
                    new [] {520, 32.710000, -96.843588},
                    new [] {538, 32.710000, -97.097534},
                    new [] {632, 32.720000, -80.085498},
                    new [] {634, 32.720000, -80.085498},
                    new [] {143, 32.720000, -80.268430},
                    new [] {510, 32.720000, -96.783416},
                    new [] {643, 32.720000, -97.237410},
                    new [] {639, 32.720000, -97.335129},
                    new [] {548, 32.720000, -97.434713},
                    new [] {544, 32.720000, -97.495585},
                    new [] {617, 32.730000, -79.975676},
                    new [] {832, 32.730000, -94.943703},
                    new [] {516, 32.730000, -96.822811},
                    new [] {545, 32.730000, -97.123682},
                    new [] {266, 32.730000, -97.484957},
                    new [] {599, 32.740000, -96.277918},
                    new [] {514, 32.740000, -96.700085},
                    new [] {543, 32.740000, -97.394745},
                    new [] {672, 32.740000, -97.632370},
                    new [] {412, 32.750000, -117.244968},
                    new [] {202, 32.750000, -81.210350},
                    new [] {247, 32.750000, -96.822036},
                    new [] {09, 32.750000, -96.830918},
                    new [] {454, 32.750000, -97.012701},
                    new [] {642, 32.750000, -97.259562},
                    new [] {552, 32.750000, -97.332953},
                    new [] {80, 32.760000, -79.831139},
                    new [] {10, 32.760000, -96.583523},
                    new [] {470, 32.760000, -97.799249},
                    new [] {57, 32.760000, -98.890193},
                    new [] {373, 32.770000, -79.973634},
                    new [] {134, 32.770000, -96.704987},
                    new [] {646, 32.770000, -97.409242},
                    new [] {624, 32.780000, -79.929373},
                    new [] {234, 32.780000, -79.930601},
                    new [] {616, 32.780000, -80.043882},
                    new [] {519, 32.780000, -96.800000},
                    new [] {521, 32.780000, -96.800000},
                    new [] {277, 32.790000, -79.876603},
                    new [] {625, 32.790000, -79.940148},
                    new [] {618, 32.790000, -79.942805},
                    new [] {612, 32.790000, -79.945353},
                    new [] {613, 32.790000, -79.948032},
                    new [] {619, 32.810000, -79.996488},
                    new [] {49, 32.810000, -80.002494},
                    new [] {511, 32.810000, -96.721766},
                    new [] {480, 32.810000, -96.773229},
                    new [] {513, 32.810000, -96.793943},
                    new [] {354, 32.810000, -96.949944},
                    new [] {160, 32.810000, -98.117639},
                    new [] {512, 32.820000, -96.807529},
                    new [] {648, 32.820000, -97.226831},
                    new [] {471, 32.820000, -97.418479},
                    new [] {825, 32.830000, -116.754328},
                    new [] {508, 32.830000, -96.752918},
                    new [] {547, 32.830000, -97.142381},
                    new [] {635, 32.840000, -79.814974},
                    new [] {615, 32.840000, -80.048905},
                    new [] {850, 32.840000, -96.581226},
                    new [] {598, 32.850000, -96.479829},
                    new [] {515, 32.850000, -96.651997},
                    new [] {517, 32.850000, -96.708892},
                    new [] {830, 32.850000, -96.772349},
                    new [] {859, 32.860000, -96.592570},
                    new [] {839, 32.860000, -96.604365},
                    new [] {356, 32.870000, -96.717037},
                    new [] {638, 32.880000, -79.982760},
                    new [] {290, 32.880000, -96.851025},
                    new [] {654, 32.880000, -97.185955},
                    new [] {525, 32.890000, -96.648251},
                    new [] {518, 32.890000, -96.806772},
                    new [] {23, 32.900000, -105.956442},
                    new [] {254, 32.900000, -80.658643},
                    new [] {397, 32.900000, -96.838203},
                    new [] {652, 32.910000, -80.101446},
                    new [] {7, 32.910000, -80.650301},
                    new [] {98, 32.910000, -98.406483},
                    new [] {432, 32.920000, -96.786366},
                    new [] {524, 32.930000, -96.665373},
                    new [] {434, 32.940000, -96.885916},
                    new [] {137, 32.940000, -97.133889},
                    new [] {132, 32.950000, -96.729444},
                    new [] {154, 32.950000, -97.116698},
                    new [] {748, 32.960000, -117.054690},
                    new [] {362, 32.960000, -117.110833},
                    new [] {837, 32.960000, -95.290999},
                    new [] {102, 32.960000, -96.959673},
                    new [] {505, 32.970000, -96.842634},
                    new [] {225, 32.990000, -80.019948},
                    new [] {92, 32.990000, -80.033053},
                    new [] {162, 32.990000, -94.960056},
                    new [] {653, 33.010000, -80.187630},
                    new [] {114, 33.010000, -81.306076},
                    new [] {592, 33.010000, -97.096667},
                    new [] {651, 33.020000, -80.178900},
                    new [] {72, 33.020000, -96.681640},
                    new [] {829, 33.030000, -94.720181},
                    new [] {267, 33.070000, -96.781643},
                    new [] {503, 33.080000, -96.710726},
                    new [] {836, 33.080000, -96.882552},
                    new [] {181, 33.090000, -96.081503},
                    new [] {671, 33.090000, -98.578825},
                    new [] {213, 33.100000, -79.479982},
                    new [] {712, 33.120000, -117.223619},
                    new [] {117, 33.120000, -94.166528},
                    new [] {594, 33.130000, -96.835606},
                    new [] {27, 33.140000, -95.580322},
                    new [] {52, 33.150000, -80.061138},
                    new [] {417, 33.190000, -117.370543},
                    new [] {60, 33.190000, -95.224627},
                    new [] {462, 33.200000, -117.185742},
                    new [] {119, 33.200000, -96.602643},
                    new [] {526, 33.200000, -96.618851},
                    new [] {834, 33.200000, -96.664223},
                    new [] {523, 33.220000, -97.155130},
                    new [] {657, 33.220000, -97.742895},
                    new [] {662, 33.220000, -98.157364},
                    new [] {55, 33.230000, -80.037179},
                    new [] {199, 33.230000, -81.352310},
                    new [] {522, 33.230000, -97.133558},
                    new [] {506, 33.240000, -95.908738},
                    new [] {28, 33.320000, -105.632780},
                    new [] {203, 33.320000, -81.140720},
                    new [] {325, 33.330000, -118.343706},
                    new [] {79, 33.330000, -79.922922},
                    new [] {177, 33.340000, -81.140012},
                    new [] {215, 33.360000, -81.271844},
                    new [] {297, 33.380000, -117.248134},
                    new [] {191, 33.380000, -79.294722},
                    new [] {30, 33.390000, -80.347500},
                    new [] {127, 33.420000, -94.043239},
                    new [] {85, 33.440000, -80.064283},
                    new [] {86, 33.440000, -94.080349},
                    new [] {721, 33.450000, -79.561997},
                    new [] {120, 33.450000, -94.416481},
                    new [] {722, 33.470000, -79.138863},
                    new [] {435, 33.480000, -80.871986},
                    new [] {476, 33.480000, -86.667895},
                    new [] {640, 33.490000, -80.855173},
                    new [] {856, 33.500000, -117.665290},
                    new [] {820, 33.510000, -111.898333},
                    new [] {403, 33.530000, -111.994280},
                    new [] {790, 33.530000, -84.354438},
                    new [] {795, 33.550000, -79.052750},
                    new [] {187, 33.570000, -97.856847},
                    new [] {641, 33.580000, -79.132096},
                    new [] {166, 33.580000, -96.181486},
                    new [] {198, 33.590000, -80.360566},
                    new [] {379, 33.620000, -117.926273},
                    new [] {183, 33.620000, -79.004155},
                    new [] {125, 33.620000, -97.142182},
                    new [] {115, 33.640000, -96.611424},
                    new [] {394, 33.660000, -95.554571},
                    new [] {94, 33.670000, -79.829666},
                    new [] {214, 33.690000, -80.856286},
                    new [] {636, 33.710000, -78.863072},
                    new [] {857, 33.740000, -117.818790},
                    new [] {782, 33.750000, -84.747778},
                    new [] {269, 33.770000, -118.146345},
                    new [] {835, 33.810000, -96.690562},
                    new [] {186, 33.820000, -98.187218},
                    new [] {637, 33.830000, -78.666362},
                    new [] {89, 33.830000, -84.377842},
                    new [] {628, 33.840000, -79.049596},
                    new [] {109, 33.850000, -83.917016},
                    new [] {661, 33.860000, -98.524964},
                    new [] {541, 33.860000, -98.569900},
                    new [] {220, 33.880000, -80.402761},
                    new [] {655, 33.910000, -80.349478},
                    new [] {663, 33.910000, -98.494777},
                    new [] {443, 33.920000, -117.933407},
                    new [] {66, 33.920000, -80.341426},
                    new [] {723, 33.940000, -80.498719},
                    new [] {774, 33.940000, -84.294315},
                    new [] {752, 33.980000, -117.349770},
                    new [] {33, 33.980000, -84.550697},
                    new [] {155, 34.080000, -80.562660},
                    new [] {540, 34.080000, -98.560654},
                    new [] {378, 34.160000, -118.384714},
                    new [] {630, 34.180000, -79.793233},
                    new [] {419, 34.190000, -118.303643},
                    new [] {360, 34.190000, -79.765736},
                    new [] {257, 34.220000, -118.234279},
                    new [] {221, 34.250000, -79.794547},
                    new [] {773, 34.300000, -77.875039},
                    new [] {77, 34.300000, -79.868845},
                    new [] {12, 34.380000, -80.069072},
                    new [] {737, 34.410000, -103.205337},
                    new [] {164, 34.420000, -79.376576},
                    new [] {466, 34.430000, -119.723031},
                    new [] {151, 34.430000, -119.800659},
                    new [] {96, 34.610000, -79.679682},
                    new [] {130, 34.700000, -79.887661},
                    new [] {800, 34.820000, -82.228861},
                    new [] {753, 34.850000, -82.406049},
                    new [] {170, 34.860000, -84.320153},
                    new [] {554, 34.950000, -80.673041},
                    new [] {314, 34.960000, -81.896076},
                    new [] {734, 34.990000, -85.326340},
                    new [] {87, 35.000000, -106.715443},
                    new [] {13, 35.040000, -89.666668},
                    new [] {99, 35.050000, -85.290607},
                    new [] {799, 35.070000, -83.216044},
                    new [] {319, 35.090000, -106.611704},
                    new [] {822, 35.110000, -106.566499},
                    new [] {121, 35.110000, -89.927171},
                    new [] {330, 35.120000, -118.450050},
                    new [] {658, 35.150000, -119.456842},
                    new [] {771, 35.160000, -80.737144},
                    new [] {798, 35.180000, -83.388479},
                    new [] {6, 35.200000, -111.643984},
                    new [] {410, 35.200000, -87.032981},
                    new [] {67, 35.210000, -86.096907},
                    new [] {345, 35.220000, -89.750545},
                    new [] {675, 35.330000, -119.092128},
                    new [] {223, 35.360000, -107.935662},
                    new [] {20, 35.360000, -86.209091},
                    new [] {323, 35.360000, -97.517300},
                    new [] {677, 35.370000, -119.027291},
                    new [] {84, 35.390000, -118.967439},
                    new [] {676, 35.410000, -119.021521},
                    new [] {770, 35.420000, -82.574551},
                    new [] {769, 35.480000, -120.663838},
                    new [] {689, 35.500000, -119.270833},
                    new [] {321, 35.520000, -86.070273},
                    new [] {793, 35.590000, -82.407705},
                    new [] {797, 35.600000, -82.554167},
                    new [] {387, 35.640000, -117.672219},
                    new [] {730, 35.690000, -105.933445},
                    new [] {762, 35.690000, -79.811406},
                    new [] {359, 35.700000, -88.887446},
                    new [] {25, 35.740000, -118.414605},
                    new [] {385, 35.770000, -119.233781},
                    new [] {326, 35.790000, -78.649743},
                    new [] {255, 35.860000, -78.671766},
                    new [] {777, 35.920000, -84.130373},
                    new [] {310, 35.970000, -86.504818},
                    new [] {674, 36.010000, -120.128435},
                    new [] {747, 36.020000, -96.012012},
                    new [] {430, 36.030000, -86.907198},
                    new [] {687, 36.070000, -119.018394},
                    new [] {245, 36.080000, -86.808389},
                    new [] {679, 36.100000, -119.572052},
                    new [] {772, 36.100000, -79.879365},
                    new [] {276, 36.100000, -95.842392},
                    new [] {311, 36.120000, -86.831588},
                    new [] {678, 36.130000, -120.368259},
                    new [] {841, 36.160000, -86.640274},
                    new [] {684, 36.210000, -119.085336},
                    new [] {357, 36.210000, -86.325106},
                    new [] {660, 36.230000, -119.321921},
                    new [] {755, 36.270000, -95.855027},
                    new [] {178, 36.310000, -119.798829},
                    new [] {709, 36.320000, -76.156720},
                    new [] {287, 36.320000, -86.585245},
                    new [] {664, 36.330000, -119.308829},
                    new [] {683, 36.330000, -119.646056},
                    new [] {42, 36.420000, -119.098930},
                    new [] {455, 36.590000, -121.872689},
                    new [] {71, 36.610000, -118.057523},
                    new [] {350, 36.610000, -119.448696},
                    new [] {22, 36.670000, -77.551050},
                    new [] {390, 36.730000, -108.205284},
                    new [] {165, 36.740000, -119.678864},
                    new [] {682, 36.750000, -119.747678},
                    new [] {376, 36.750000, -76.210549},
                    new [] {252, 36.790000, -119.755365},
                    new [] {680, 36.790000, -119.755620},
                    new [] {681, 36.790000, -119.755620},
                    new [] {355, 36.810000, -119.808510},
                    new [] {296, 36.820000, -77.483162},
                    new [] {270, 36.870000, -75.981606},
                    new [] {161, 37.000000, -89.166207},
                    new [] {116, 37.060000, -120.858290},
                    new [] {328, 37.090000, -94.517643},
                    new [] {122, 37.170000, -101.353350},
                    new [] {780, 37.230000, -80.414440},
                    new [] {700, 37.250000, -121.931293},
                    new [] {824, 37.280000, -121.947017},
                    new [] {710, 37.320000, -79.999379},
                    new [] {685, 37.330000, -120.473494},
                    new [] {551, 37.350000, -120.595941},
                    new [] {816, 37.360000, -122.133343},
                    new [] {172, 37.370000, -118.400166},
                    new [] {686, 37.380000, -119.626179},
                    new [] {750, 37.410000, -79.142500},
                    new [] {801, 37.440000, -76.320278},
                    new [] {149, 37.500000, -119.975947},
                    new [] {405, 37.520000, -77.479650},
                    new [] {704, 37.560000, -77.442597},
                    new [] {347, 37.580000, -101.369589},
                    new [] {281, 37.590000, -77.548455},
                    new [] {649, 37.670000, -120.957547},
                    new [] {475, 37.690000, -85.857489},
                    new [] {659, 37.700000, -121.434713},
                    new [] {667, 37.720000, -89.219471},
                    new [] {688, 37.730000, -120.954151},
                    new [] {694, 37.730000, -88.925254},
                    new [] {693, 37.740000, -88.539324},
                    new [] {16, 37.770000, -120.849544},
                    new [] {14, 37.810000, -121.198751},
                    new [] {65, 37.900000, -88.929900},
                    new [] {138, 37.910000, -120.602011},
                    new [] {727, 37.920000, -76.474305},
                    new [] {741, 37.920000, -99.409847},
                    new [] {732, 37.940000, -101.266640},
                    new [] {447, 37.960000, -121.290647},
                    new [] {433, 37.960000, -84.480947},
                    new [] {128, 37.990000, -120.385720},
                    new [] {474, 37.990000, -87.556169},
                    new [] {342, 38.050000, -84.728635},
                    new [] {778, 38.060000, -78.581978},
                    new [] {17, 38.090000, -88.538101},
                    new [] {304, 38.230000, -122.639679},
                    new [] {226, 38.300000, -76.531228},
                    new [] {124, 38.310000, -85.577696},
                    new [] {21, 38.320000, -88.904981},
                    new [] {665, 38.380000, -88.057730},
                    new [] {159, 38.410000, -87.760891},
                    new [] {303, 38.470000, -107.839666},
                    new [] {51, 38.480000, -99.178207},
                    new [] {286, 38.500000, -76.537477},
                    new [] {690, 38.500000, -89.151103},
                    new [] {714, 38.520000, -89.982060},
                    new [] {853, 38.570000, -90.524939},
                    new [] {324, 38.610000, -122.867965},
                    new [] {152, 38.630000, -88.949715},
                    new [] {697, 38.630000, -89.909912},
                    new [] {370, 38.640000, -77.365594},
                    new [] {393, 38.680000, -77.020548},
                    new [] {377, 38.680000, -77.305221},
                    new [] {692, 38.700000, -90.144228},
                    new [] {858, 38.720000, -77.106904},
                    new [] {75, 38.730000, -88.079868},
                    new [] {42, 38.740000, -108.071555},
                    new [] {91, 38.750000, -89.979603},
                    new [] {233, 38.790000, -77.616254},
                    new [] {271, 38.810000, -77.638580},
                    new [] {791, 38.820000, -76.661920},
                    new [] {388, 38.830000, -77.272030},
                    new [] {238, 38.840000, -77.435091},
                    new [] {845, 38.850000, -104.822600},
                    new [] {280, 38.850000, -77.306667},
                    new [] {258, 38.850000, -77.308555},
                    new [] {754, 38.860000, -104.916444},
                    new [] {371, 38.880000, -77.172176},
                    new [] {666, 38.890000, -90.185193},
                    new [] {404, 38.900000, -77.386069},
                    new [] {442, 38.940000, -76.929293},
                    new [] {236, 38.960000, -94.649460},
                    new [] {246, 38.970000, -77.076763},
                    new [] {194, 39.010000, -77.428889},
                    new [] {184, 39.010000, -87.748352},
                    new [] {792, 39.020000, -76.598660},
                    new [] {409, 39.020000, -97.603121},
                    new [] {210, 39.040000, -77.487778},
                    new [] {169, 39.060000, -104.863267},
                    new [] {110, 39.120000, -77.563889},
                    new [] {148, 39.120000, -88.548173},
                    new [] {316, 39.140000, -121.650891},
                    new [] {775, 39.150000, -84.428121},
                    new [] {426, 39.270000, -76.732180},
                    new [] {444, 39.270000, -76.732187},
                    new [] {715, 39.270000, -90.076632},
                    new [] {463, 39.280000, -76.740124},
                    new [] {126, 39.280000, -89.881513},
                    new [] {414, 39.300000, -76.621507},
                    new [] {74, 39.400000, -75.036651},
                    new [] {217, 39.410000, -76.713333},
                    new [] {854, 39.470000, -75.123114},
                    new [] {457, 39.480000, -76.376195},
                    new [] {73, 39.480000, -88.381684},
                    new [] {291, 39.570000, -76.989769},
                    new [] {24, 39.570000, -97.659599},
                    new [] {719, 39.610000, -87.697079},
                    new [] {349, 39.630000, -79.953104},
                    new [] {327, 39.640000, -119.836675},
                    new [] {123, 39.710000, -90.727751},
                    new [] {413, 39.720000, -84.066816},
                    new [] {106, 39.730000, -90.233122},
                    new [] {272, 39.790000, -89.638953},
                    new [] {718, 39.790000, -89.653484},
                    new [] {263, 39.790000, -89.653485},
                    new [] {699, 39.800000, -89.647731},
                    new [] {716, 39.840000, -88.954722},
                    new [] {322, 39.880000, -74.970568},
                    new [] {483, 39.900000, -79.728704},
                    new [] {301, 39.900000, -80.173402},
                    new [] {784, 39.900000, -86.184809},
                    new [] {381, 39.910000, -75.322614},
                    new [] {382, 39.910000, -75.322614},
                    new [] {847, 39.920000, -105.066796},
                    new [] {282, 39.930000, -91.404628},
                    new [] {464, 39.960000, -75.175130},
                    new [] {477, 40.000000, -75.182446},
                    new [] {380, 40.010000, -75.271572},
                    new [] {395, 40.020000, -79.095880},
                    new [] {93, 40.020000, -79.880493},
                    new [] {427, 40.030000, -75.326289},
                    new [] {375, 40.040000, -75.491902},
                    new [] {840, 40.050000, -86.149907},
                    new [] {195, 40.100000, -79.593017},
                    new [] {133, 40.120000, -90.568055},
                    new [] {706, 40.130000, -74.032769},
                    new [] {817, 40.140000, -120.947910},
                    new [] {32, 40.140000, -75.451646},
                    new [] {331, 40.140000, -79.901034},
                    new [] {717, 40.150000, -89.365250},
                    new [] {253, 40.160000, -80.243093},
                    new [] {848, 40.180000, -105.198541},
                    new [] {337, 40.180000, -79.856830},
                    new [] {81, 40.190000, -79.242617},
                    new [] {489, 40.200000, -79.923689},
                    new [] {383, 40.230000, -74.935272},
                    new [] {492, 40.290000, -79.884904},
                    new [] {41, 40.300000, -79.544692},
                    new [] {88, 40.300000, -80.073695},
                    new [] {131, 40.300000, -90.062258},
                    new [] {720, 40.310000, -88.133564},
                    new [] {493, 40.330000, -78.920226},
                    new [] {713, 40.330000, -79.614507},
                    new [] {334, 40.330000, -79.866759},
                    new [] {481, 40.350000, -79.864915},
                    new [] {537, 40.360000, -91.437436},
                    new [] {228, 40.380000, -74.418921},
                    new [] {192, 40.380000, -90.156287},
                    new [] {488, 40.390000, -80.028812},
                    new [] {499, 40.410000, -80.083669},
                    new [] {140, 40.420000, -79.660594},
                    new [] {486, 40.430000, -79.265740},
                    new [] {484, 40.430000, -79.762279},
                    new [] {274, 40.430000, -80.010612},
                    new [] {38, 40.440000, -79.985110},
                    new [] {90, 40.440000, -79.996111},
                    new [] {227, 40.440000, -79.998053},
                    new [] {487, 40.440000, -79.998794},
                    new [] {398, 40.440000, -80.063887},
                    new [] {482, 40.450000, -79.947275},
                    new [] {501, 40.450000, -80.018388},
                    new [] {308, 40.460000, -79.830890},
                    new [] {485, 40.460000, -79.947695},
                    new [] {534, 40.460000, -90.669738},
                    new [] {497, 40.480000, -79.841380},
                    new [] {500, 40.500000, -80.203902},
                    new [] {696, 40.500000, -88.986838},
                    new [] {364, 40.520000, -79.841474},
                    new [] {353, 40.530000, -79.886666},
                    new [] {495, 40.540000, -79.981745},
                    new [] {344, 40.540000, -80.184064},
                    new [] {386, 40.560000, -80.273435},
                    new [] {494, 40.570000, -79.755295},
                    new [] {209, 40.570000, -80.490023},
                    new [] {698, 40.570000, -89.646564},
                    new [] {828, 40.580000, -105.070046},
                    new [] {249, 40.580000, -80.226241},
                    new [] {498, 40.610000, -79.742060},
                    new [] {5, 40.610000, -89.465024},
                    new [] {491, 40.620000, -79.156185},
                    new [] {336, 40.630000, -79.605833},
                    new [] {465, 40.630000, -89.712405},
                    new [] {473, 40.640000, -79.943305},
                    new [] {338, 40.650000, -111.497222},
                    new [] {758, 40.650000, -111.497222},
                    new [] {445, 40.650000, -75.508826},
                    new [] {786, 40.670000, -74.215746},
                    new [] {189, 40.670000, -80.096393},
                    new [] {647, 40.680000, -73.417374},
                    new [] {333, 40.700000, -79.662991},
                    new [] {496, 40.700000, -80.302518},
                    new [] {340, 40.710000, -89.573537},
                    new [] {530, 40.710000, -89.649309},
                    new [] {367, 40.730000, -80.310429},
                    new [] {392, 40.730000, -89.602559},
                    new [] {448, 40.740000, -73.878410},
                    new [] {531, 40.740000, -89.014048},
                    new [] {673, 40.740000, -89.619924},
                    new [] {108, 40.750000, -73.968068},
                    new [] {369, 40.770000, -80.326306},
                    new [] {783, 40.780000, -84.127828},
                    new [] {365, 40.790000, -79.299102},
                    new [] {843, 40.800000, -89.627085},
                    new [] {415, 40.810000, -79.521095},
                    new [] {528, 40.810000, -89.635570},
                    new [] {61, 40.840000, -89.886354},
                    new [] {490, 40.860000, -79.892613},
                    new [] {703, 40.890000, -80.693575},
                    new [] {461, 40.910000, -90.645550},
                    new [] {815, 40.940000, -74.580477},
                    new [] {532, 40.980000, -90.367902},
                    new [] {743, 41.040000, -83.650000},
                    new [] {408, 41.080000, -81.491791},
                    new [] {275, 41.110000, -73.485015},
                    new [] {533, 41.110000, -89.358942},
                    new [] {261, 41.120000, -81.640006},
                    new [] {527, 41.160000, -81.225012},
                    new [] {318, 41.170000, -104.830366},
                    new [] {446, 41.210000, -95.945928},
                    new [] {306, 41.240000, -73.943636},
                    new [] {31, 41.250000, -89.924722},
                    new [] {56, 41.260000, -95.973350},
                    new [] {402, 41.280000, -72.894385},
                    new [] {436, 41.290000, -72.375668},
                    new [] {535, 41.310000, -90.626818},
                    new [] {846, 41.320000, -82.604359},
                    new [] {82, 41.350000, -72.029472},
                    new [] {8, 41.360000, -89.466449},
                    new [] {237, 41.430000, -81.922751},
                    new [] {58, 41.450000, -90.157207},
                    new [] {813, 41.460000, -87.155004},
                    new [] {450, 41.490000, -71.319433},
                    new [] {248, 41.490000, -81.959964},
                    new [] {440, 41.500000, -81.626762},
                    new [] {283, 41.500000, -90.408263},
                    new [] {529, 41.500000, -90.511940},
                    new [] {536, 41.510000, -90.574317},
                    new [] {425, 41.590000, -70.945034},
                    new [] {243, 41.600000, -73.120102},
                    new [] {62, 41.600000, -90.917294},
                    new [] {814, 41.630000, -86.756542},
                    new [] {452, 41.630000, -87.483611},
                    new [] {193, 41.680000, -70.514317},
                    new [] {441, 41.680000, -72.944003},
                    new [] {182, 41.700000, -72.910085},
                    new [] {439, 41.710000, -70.080264},
                    new [] {363, 41.710000, -71.536204},
                    new [] {329, 41.780000, -71.400893},
                    new [] {312, 41.780000, -81.103269},
                    new [] {744, 41.830000, -87.819720},
                    new [] {708, 41.860000, -88.194672},
                    new [] {101, 41.880000, -88.308946},
                    new [] {260, 41.970000, -71.318616},
                    new [] {289, 41.970000, -87.662405},
                    new [] {453, 42.010000, -87.670182},
                    new [] {437, 42.050000, -87.675466},
                    new [] {575, 42.060000, -75.420853},
                    new [] {45, 42.080000, -74.994747},
                    new [] {416, 42.080000, -76.043904},
                    new [] {428, 42.090000, -75.908351},
                    new [] {76, 42.100000, -71.383685},
                    new [] {449, 42.110000, -70.938432},
                    new [] {105, 42.110000, -71.661640},
                    new [] {302, 42.160000, -78.711194},
                    new [] {206, 42.170000, -74.016674},
                    new [] {582, 42.170000, -75.128791},
                    new [] {278, 42.190000, -71.832001},
                    new [] {216, 42.200000, -74.101441},
                    new [] {348, 42.220000, -73.863475},
                    new [] {112, 42.250000, -73.649405},
                    new [] {37, 42.280000, -74.918218},
                    new [] {2, 42.300000, -74.002364},
                    new [] {580, 42.310000, -75.395043},
                    new [] {812, 42.320000, -122.964897},
                    new [] {78, 42.320000, -75.331173},
                    new [] {204, 42.340000, -75.148475},
                    new [] {372, 42.350000, -71.553594},
                    new [] {171, 42.350000, -73.803668},
                    new [] {219, 42.350000, -74.807118},
                    new [] {358, 42.350000, -87.883414},
                    new [] {572, 42.360000, -73.602667},
                    new [] {577, 42.360000, -74.675889},
                    new [] {4, 42.390000, -73.698497},
                    new [] {211, 42.410000, -74.022222},
                    new [] {742, 42.410000, -88.070432},
                    new [] {43, 42.460000, -73.397625},
                    new [] {603, 42.460000, -75.059443},
                    new [] {107, 42.470000, -75.326111},
                    new [] {113, 42.470000, -79.177086},
                    new [] {47, 42.550000, -75.248356},
                    new [] {196, 42.560000, -74.329168},
                    new [] {292, 42.580000, -71.800941},
                    new [] {605, 42.580000, -73.705459},
                    new [] {190, 42.590000, -74.814863},
                    new [] {400, 42.590000, -83.328679},
                    new [] {259, 42.620000, -70.876586},
                    new [] {570, 42.620000, -73.820946},
                    new [] {606, 42.650000, -73.734615},
                    new [] {567, 42.650000, -73.754646},
                    new [] {565, 42.650000, -73.758606},
                    new [] {264, 42.650000, -73.758806},
                    new [] {54, 42.650000, -74.796560},
                    new [] {66, 42.660000, -73.768199},
                    new [] {787, 42.670000, -71.584515},
                    new [] {29, 42.680000, -74.479542},
                    new [] {602, 42.700000, -74.923415},
                    new [] {153, 42.710000, -73.927663},
                    new [] {571, 42.720000, -73.701897},
                    new [] {607, 42.730000, -73.683659},
                    new [] {609, 42.730000, -73.690314},
                    new [] {608, 42.730000, -73.694168},
                    new [] {569, 42.730000, -73.834886},
                    new [] {803, 42.730000, -84.555556},
                    new [] {35, 42.740000, -73.759537},
                    new [] {157, 42.770000, -73.674582},
                    new [] {779, 42.770000, -78.613611},
                    new [] {560, 42.790000, -73.678534},
                    new [] {241, 42.800000, -73.930581},
                    new [] {610, 42.800000, -73.963393},
                    new [] {273, 42.810000, -70.940117},
                    new [] {366, 42.830000, -73.968588},
                    new [] {141, 42.860000, -73.328611},
                    new [] {555, 42.870000, -73.798221},
                    new [] {207, 42.890000, -73.358105},
                    new [] {604, 42.890000, -73.358105},
                    new [] {56, 42.900000, -73.686943},
                    new [] {83, 42.900000, -74.571101},
                    new [] {557, 42.910000, -73.890958},
                    new [] {224, 42.930000, -73.770127},
                    new [] {424, 42.940000, -78.800652},
                    new [] {759, 42.960000, -83.856325},
                    new [] {15, 42.990000, -78.833614},
                    new [] {556, 43.000000, -73.849252},
                    new [] {396, 43.000000, -76.143429},
                    new [] {761, 43.000000, -76.143429},
                    new [] {1, 43.010000, -74.372748},
                    new [] {185, 43.010000, -75.003710},
                    new [] {597, 43.010000, -75.041014},
                    new [] {9, 43.010000, -78.192554},
                    new [] {621, 43.030000, -73.382431},
                    new [] {596, 43.030000, -74.988933},
                    new [] {158, 43.040000, -74.855783},
                    new [] {3, 43.050000, -74.346431},
                    new [] {422, 43.050000, -83.305400},
                    new [] {558, 43.080000, -73.787657},
                    new [] {294, 43.080000, -78.960182},
                    new [] {3, 43.090000, -70.813156},
                    new [] {44, 43.090000, -73.501384},
                    new [] {842, 43.090000, -88.421997},
                    new [] {559, 43.100000, -73.582980},
                    new [] {756, 43.110000, -88.499139},
                    new [] {600, 43.140000, -74.923978},
                    new [] {298, 43.160000, -77.607978},
                    new [] {627, 43.180000, -73.332703},
                    new [] {438, 43.260000, -82.633721},
                    new [] {622, 43.270000, -73.585751},
                    new [] {64, 43.300000, -70.975800},
                    new [] {623, 43.300000, -73.583862},
                    new [] {562, 43.310000, -73.647451},
                    new [] {70, 43.320000, -73.838086},
                    new [] {346, 43.410000, -73.256504},
                    new [] {595, 43.470000, -74.422563},
                    new [] {451, 43.500000, -73.787126},
                    new [] {626, 43.510000, -73.330114},
                    new [] {629, 43.550000, -73.403471},
                    new [] {139, 43.550000, -73.661134},
                    new [] {458, 43.660000, -70.252698},
                    new [] {564, 43.690000, -73.756438},
                    new [] {167, 43.700000, -73.720458},
                    new [] {168, 43.700000, -73.720458},
                    new [] {561, 43.700000, -73.720458},
                    new [] {563, 43.700000, -73.720458},
                    new [] {588, 43.700000, -73.720458},
                    new [] {222, 43.840000, -74.429831},
                    new [] {589, 43.850000, -73.423227},
                    new [] {587, 43.970000, -74.165000},
                    new [] {423, 44.010000, -70.082831},
                    new [] {335, 44.050000, -123.085556},
                    new [] {411, 44.070000, -92.510536},
                    new [] {118, 44.160000, -75.033015},
                    new [] {305, 44.190000, -88.454132},
                    new [] {5, 44.210000, -73.593100},
                    new [] {332, 44.220000, -74.443965},
                    new [] {91, 44.340000, -75.467203},
                    new [] {205, 44.450000, -73.685672},
                    new [] {341, 44.580000, -75.647016},
                    new [] {614, 44.590000, -75.162792},
                    new [] {46, 44.590000, -75.650605},
                    new [] {11, 44.600000, -75.166381},
                    new [] {585, 44.650000, -73.440429},
                    new [] {620, 44.660000, -74.968076},
                    new [] {145, 44.700000, -75.489619},
                    new [] {129, 44.750000, -74.993438},
                    new [] {590, 44.850000, -74.290523},
                    new [] {34, 44.860000, -75.201821},
                    new [] {701, 44.920000, -93.169327},
                    new [] {459, 44.920000, -93.355509},
                    new [] {40, 44.930000, -74.891972},
                    new [] {852, 44.930000, -93.411214},
                    new [] {179, 44.990000, -73.442889},
                    new [] {469, 45.050000, -64.725430},
                    new [] {827, 45.300000, -122.769886},
                    new [] {707, 45.560000, -122.547079},
                    new [] {745, 45.780000, -108.500000},
                    new [] {502, 46.010000, -112.540528},
                    new [] {746, 46.030000, -112.535772},
                    new [] {702, 46.410000, -105.845955},
                    new [] {811, 47.240000, -122.479449},
                    new [] {88, 47.630000, -117.358862},
                    new [] {232, 47.670000, -122.384748},
                    new [] {809, 47.740000, -122.331083},
                    new [] {810, 47.740000, -122.343132},
                    new [] {229, 47.750000, -122.638694},
                    new [] {826, 47.870000, -121.772743},
                    new [] {855, 48.030000, -122.031367},
                    new [] {156, 48.270000, -122.645833},
                    new [] {794, 48.440000, -122.336365},
                    new [] {460, 51.040000, -114.029769},
                    new [] {268, 61.220000, -149.891667},
                    new [] {53, 61.330000, -149.555507}
                });
        }
    }
}